﻿@model ListViewModel<CommonSearchValues, IQueryable<QizSmsSession>>
@{
    ViewBag.Title = "短信随访查询";
}
@using (Ajax.BeginForm("QizSmsSessionList", new { IsView = false }, new AjaxOptions { HttpMethod = "Post", LoadingElementId = "OnLoadingSpan", UpdateTargetId = "main", OnFailure = "OnSiteError" }))
{<p>
    <fieldset>
        <legend>
            <div class="catalog-title">
                短信随访查询</div>
        </legend>
        @if (SiteUser.MainRoleName == "Doctor")
        {
            @Html.Action("SmsSFReport")
        }
        @Html.HiddenFor(m => Model.PageSize)
       <input type="hidden" name="PageIdx" id="qspidx" value="0" />
        随访单名称： @Html.DropDownListFor(m => m.SearchFrom.V1, new SelectList(ViewBag.Subjects, "ID", "Title", Model.SearchFrom.V1), "全部")
        @*填报人：@Html.DropDownListFor(m => m.SearchFrom.V2, new SelectList(ViewBag.Recupers, "UserID", "UserName", Model.SearchFrom.V2), "全部")*@
        <span class="small-input">填报人：@Html.EditorFor(m => m.SearchFrom.V2, "UserName")</span>
        开始时间：@Html.EditorFor(m => m.SearchFrom.V3, "DateTimeStr")
        结束时间：@Html.EditorFor(m => m.SearchTo.V3, "DateTimeStr")
        @Helpers.SubmitButton("查询", "qssubmit")
    </fieldset>
    </p>
}
<table class="width">
    <tr>
        <th>
            常规随访名称
        </th>
        <th>
            填报人
        </th>
        <th>
            性别
        </th>
        <th>
            随访类型
        </th>
        <th>
            出院日期
        </th>
        <th>
            填报时间
        </th>
        <th>
            检查时间
        </th>
        <th>
            指标异常
        </th>
        <th>
            新
        </th>
        <th>
            操作
        </th>
    </tr>
    @{int dColor = 0;}
    @foreach (var item in Model.Data)
    {
        <tr class="tr-backColor@(dColor++ % 2)" style="@(item.SessionAutoEvalution == "异常" ? "color:red" : "")">
            <td>@Html.DisplayFor(model => item.QizSmsSubjectMonthIdx.QizSmsSubject.Title)
            </td>
            <td>
                @Ajax.ActionLink(item.Recuper.User.UserName, "RecuperEnHospEdit", new { ID = item.Recuper.RecuperID, _t = DateTime.Now.Ticks, _ReadOnly = false }, new AjaxOptions() { LoadingElementId = "OnLoadingSpan", UpdateTargetId = "dialogbox", OnComplete = "showDialog('患者信息');", HttpMethod = "Get", InsertionMode = InsertionMode.Replace, OnFailure = "OnSiteError" })
            </td>
            <td>@Html.DisplayFor(model => item.User.Gender)
            </td>
            <td>@Html.DisplayFor(model => item.Recuper.SuiFangLeiXing)
            </td>
            <td>
                @if (item.Recuper.DeHospDay != DateTime.MinValue)
                {
                    @Html.DisplayFor(model => item.Recuper.DeHospDay)
                }
            </td>
            <td>@item.CreationTime.ToString("yyyy/MM/dd")
            </td>
            <td>@item.Timemark.ToString("yyyy/MM/dd")
            </td>
            <td>@(item.SessionAutoEvalution == "异常" ? item.SessionAutoEvalution : string.Empty)
            </td>
            <td id="NT_@(item.ID)" align="center">
                @if (item.UnRead)
                {
                    @Ajax.ActionLink("★", "SetQizSmsSessionReaded", new { ID = item.ID }, new AjaxOptions()
               {
                   UpdateTargetId = "NT_" + item.ID,
                   InsertionMode = InsertionMode.Replace,
                   HttpMethod = "Get",
                   //OnSuccess = "OnS",
                   OnFailure = "OnSiteError"
               }, new { style = "color:#f19149;text-decoration:none;" })
                }
            </td>
            <td>
                @Ajax.ActionLink("[详细]", "QizSmsSessionView", new { ID = item.ID, PreviewOnly = true }, new AjaxOptions() { LoadingElementId = "OnLoadingSpan", UpdateTargetId = "dialogbox", OnComplete = "showDialog('短信随访内容');", HttpMethod = "Get", InsertionMode = InsertionMode.Replace, OnFailure = "OnSiteError" })
                @Ajax.ActionLink("[补录]", "QizSmsSessionView", new { ID = item.ID, PreviewOnly = false }, new AjaxOptions() { LoadingElementId = "OnLoadingSpan", UpdateTargetId = "dialogbox", OnComplete = "showDialog('短信随访内容');", HttpMethod = "Get", InsertionMode = InsertionMode.Replace, OnFailure = "OnSiteError" })
                @Html.ActionLink("[历史]", "RecuperReport", new { qizSubjectID = item.QizSmsSubjectMonthIdx.QizSmsSubject.QizSubject.ID, recuperID = item.Recuper.RecuperID, pageIndex = 0 }, new { target = "_blank" })
                @Ajax.ActionLink("[留言]", "SentSmsToSessionRecuper", new { reciver = item.Recuper.RecuperID }, new AjaxOptions() { LoadingElementId = "OnLoadingSpan", UpdateTargetId = "dialogbox", OnComplete = "showDialog('短信留言');", HttpMethod = "Get", InsertionMode = InsertionMode.Replace, OnFailure = "OnSiteError" })
            </td>
        </tr>
    }
</table>
<table class="width noborder">
    <tr>
        <td>
            @Html.Partial("Pagger", new PaggerViewModel { Act = "QizSmsSessionList", PageIdx = Model.PageIdx, PageCount = Model.PageCount, ItemCount = Model.ItemCount })
        </td>
        <td align="right">
            @using (Html.BeginForm("QizSmsSessionListExport", null, new { }, FormMethod.Post, new { target = "_blank", onsubmit = "alert('根据导出数据的多少，可能会有需要很长时间，导出过程请耐心等待...。');" }))
            {
                var currentFilter = new ListViewModel<CommonSearchValues, string>() { SearchFrom = Model.SearchFrom, SearchTo = Model.SearchTo };
                <span style="display: none;">
                    @Html.Hidden("CurrentFilterOfJson", System.Web.Helpers.Json.Encode(currentFilter))
                    <input type="submit" name="ExportType" value="exportsession" id="exportsession" />
                    <input type="submit" name="ExportType" value="exportdetail" id="exportdetail" />
                </span>
                <a href="#QizSmsSessionListExport" onclick="$('#exportsession').click()">导出基本短信随访数据</a> <span>&nbsp;
                    &nbsp;</span>  <a href="#QizSmsSessionListExport" onclick="$('#exportdetail').click()">导出详细短信填报指标</a>
            }
        </td>
    </tr>
</table>
@Html.Partial("TrHilighter")